import { Menu, MenuItem, Notification } from "electron";

export let menu: Menu = null;

export function createMenu() {
  menu = new Menu();
  menu.append(
    new MenuItem({
      label: "菜单",
      submenu: [
        {
          role: "forceReload",
          label: "刷新",
        },
        {
          label: "提示",
          click: () => {
            const NOTIFICATION_TITLE = "提示";
            const NOTIFICATION_BODY = "内容";

            new Notification({
              title: NOTIFICATION_TITLE,
              body: NOTIFICATION_BODY,
            }).show();
          },
        },
      ],
    })
  );
  menu.append(
    new MenuItem({
      label: "控制台",
      role: "toggleDevTools",
    })
  );
  Menu.setApplicationMenu(menu);
}
